home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
pbwndo.zip
/
PBWINDOW.DOC
< prev
next >
Wrap
Text File
|
1991-09-01
|
103KB
|
3,433 lines
┌────────────────────────┐
│ │
│ Windows for │
│ PowerBASIC │
│ ╔════ 2.50 ═════╗ │
└────║ PBWindow.PBU ║───┘
║ Documentation ║
┌─────────────╚═══════════════╝─────────────┐
│ Copyright (c) 1987,90,91 Barry Erick │
│ 75300,214 Compuserve │
└───────────────────────────────────────────┘
┌─────────┐
┌─────┴───┐ │ (tm)
──│ │o │──────────────────
│ ┌─────┴╨──┐ │ Association of
│ │ │─┘ Shareware
└───│ o │ Professionals
──────│ ║ │────────────────────
└────╨────┘ MEMBER
Contents
1 Highlights . . . . . . . . . . . . . . . . . . 1
2 What is PBWindow . . . . . . . . . . . . . . . 5
3 How to use PBWindow with your programs . . . . 5
4 PBWindow Routines . . . . . . . . . . . . . . 8
5 The Demo PWDemo.Bas . . . . . . . . . . . . . 26
6 Potpourri . . . . . . . . . . . . . . . . . . 26
6.1 Support available . . . . . . . . . . . . 26
6.2 Source Code Available . . . . . . . . . . 27
6.3 Update availability . . . . . . . . . . . 27
6.4 Distribution of the programs . . . . . . 28
6.5 Warranty and Disclaimer . . . . . . . . . 29
6.6 Copyright Notices . . . . . . . . . . . . 29
6.7 Development System . . . . . . . . . . . 29
Appendix A Public Variables 31
Appendix B SHAREWARE 35
B.1 Definition of Shareware . . . . . . . . . . 35
B.2 Ombudsman . . . . . . . . . . . . . . . . . 35
Appendix C PBWTools - Tools for PowerBASIC 37
Index 45
i
ii
Tables
Table 1: Colors for Fc,Bc,Bfc, and Bbc . . . . . . . 10
Table 2: Box Title Locations . . . . . . . . . . . . 13
Table 3: Bars Generated . . . . . . . . . . . . . . 19
Table 4: Distributed Files . . . . . . . . . . . . . 28
iii
1 Highlights
PBWindow.PBU version 2.50 has these features:
o For PowerBASIC 2.1x Power Pak.
o Faster than ever!
o Many routines optimized.
o Many routines moved to Object files.
o PBMice - Mouse Support! - Included!
o EGA/VGA 43/50 Line Support!
o PBWTools - Toolbox included!
o 5 kinds of menus:
- No highlight
- The item is highlighted
- The item line is highlighted
- An arrow is used
- An arrow is used and the item is highlighted
o Ability to automatically make a menu selection.
o Any letter or Function Key can be used to select menu
items.
o A small featured text editor.
o Fill Screen Area procedure for even faster screen writes.
o Movable windows. Source already available in the Demo
program.
o Zoom windows. A procedure allows you to zoom windows onto
the screen.
o Tracking of all window attributes so when the window is
active, the window can be worked with, changed, and
restored to the original. This allows you to use the
window pointer (Wpt%) to reference any window and make
changes to it, if it is not overlaid by another window.
o Noise can be turned off, even if a window requests it.
o You can recolor a window instantly.
o By changing one variable in the Include file, you can
specify a minimum of 5 windows to a maximum limited by
memory and the size of your program. Since PowerBASIC no
longer limits strings to 64k, and the windows are saved in
strings, PBWindow takes advantage of these new strings.
(c) 1987-90,91 Barry Erick Page 1
PBWindow Documentation
o 12 Title area in a screen:
- Top Left
- Top Center
- Top Right
- Bottom Left
- Bottom Center
- Bottom Right
- Top Left Vertical Side
- Middle Left Vertical Side
- Lower Left Vertical Side
- Top Right Vertical Side
- Middle Right Vertical Side
- Lower Right Vertical Side
o Both vertical and horizontal centering within a box.
o 13 kinds of windows:
- Blank (no outline)
- Blank (no outline, no borders)
- Single line outline, top, bottom and sides
- Double line outline, top, bottom and sides
- Double Vertical line outline, single Horizontal
line outline
- Single Vertical line outline, double Horizontal
line outline
- Single horizontal outline, no vertical outline
- Single horizontal outline, no vertical outline, no
vertical border
- Double horizontal outline, no vertical outline
- Double horizontal outline, no vertical outline, no
vertical border
- Solid block outline, top, bottom, and sides
- Light hatch outline, top, bottom, and sides
- Medium hatch outline, top, bottom, and sides
- Heavy hatch outline, top, bottom, and sides
o 10 kinds of shadows:
- None
- Left solid drop shadow
- Right solid drop shadow
- Left transparent drop shadow
- Right transparent drop shadow
- Left light hatch drop shadow
- Right light hatch drop shadow
- Left medium hatch drop shadow
- Right medium hatch drop shadow
- Left heavy hatch drop shadow
- Right heavy hatch drop shadow
o Clear individual lines in a window.
o Change attributes in a window on a line by line basis.
Page 2 (c) 1987-90,91 Barry Erick
PBWindow Documentation
o Restore a title outline after removing the title.
o Hercules and IBM Mono compatibility. While this was
developed for color environments, it works fine for a mono
mode.
o Movement of all $Inline code to Object code.
(c) 1987-90,91 Barry Erick Page 3
PBWindow Documentation
This Page Is Blank
(except for this print)
Page 4 (c) 1987-90,91 Barry Erick
PBWindow Documentation
2 What is PBWindow
PBWindow.PBU and PBWindow.INC allows you to add pop-up windows to
your PowerBASIC programs. There are 27 Public routines in
PBWindow that you can access from your program:
1. FUNCTION GetAttribute 15. SUB NewBoxColor
2. SUB GetForAndBack 16. SUB BuildMenu
3. SUB PrtBox 17. SUB PrtAttrEOL
4. SUB Rackett 18. SUB PrtAttrEOLBox
5. SUB RemoveBox 19. SUB ClearBox
6. SUB BoxTitle 20. SUB Recolor
7. SUB MakeBox 21. SUB PBWindowInit
8. SUB ZoomBox 22. SUB ScreenInit
9. SUB PartBoxScroll 23. SUB NewSaveMouse
10. SUB BoxScroll 24. SUB NewMouseAns
11. SUB CtrBox 25. SUB GetAvailableVideo
12. SUB CtrAllBox 26. SUB FixAttr
13. SUB PrtEOL 27. FUNCTION FansWindow
14. SUB PrtEOLBox
Several routines are in the PBWOBJ3.OBJ file that are PUBLIC.
They are :
1. SUB WritVidP
2. SUB ReadVidP
3. SUB Scroll
4. SUB WriteScreenArea
5. SUB SaveScreenArea
6. SUB FillArea
7. SUB DoSaveCursor
8. SUB SetCursor
9. SUB LocateCursor
10. SUB FixLocate
3 How to use PBWindow with your programs
PBWindow can easily be added to your program. The only code
needed to compile is:
(c) 1987-90,91 Barry Erick Page 5
PBWindow Documentation
*
$PBWSmall = 0
*
%False = 0
*
%True = NOT %False
*
%NeedRodent = %True
$INCLUDE "PBWINDOW.INC"
Place this code near the start of your program. Near means you
may need some metastatements in front of this, and a DEFINT A-Z,
as the unit uses this and the $Include expects this. %NeedRodent
can be %False if you do not have a mouse or do not want one to be
used. You should set the variable Max.Window% to some value
greater than the default of 5 by placing the statement
Max.Window% = nn where n is 5 or greater. The demo uses 14. Two
Constants MUST be used. These are %PBWSmall = 0 and %NeedRodent =
0 or -1. For the registered versions, %PBWSmall means something.
For the non registered versions, this must be used for the
compile to work, but can be ignored otherwise. %NeedRodent, even
if -1 or %True, can be used even without a mouse. If none is
detected, the mouse routines are ignored anyway. You may want to
add these to the $Include file for simplicity. See the demo
source for other Constants. Also, the variable AutoBuildTime% may
1
be set. If not, it defaults to 30 seconds . A command line option
allows the overriding by specifying a value of 20 to 15000
seconds.
To use this, start PWDemo like this: PWDemo /300 and substitute
the desired time for the 300. In the example, the time delay will
be 300 seconds. The files needed to compile this with your
program (not the demo) are PBWindow.INC, PBMice.Inc, PBWObj3.Obj,
PBMiceun.PBU, and PBWindow.PBU.
The .INC files should reside in your Include directory, the .OBJ
files in your Object file directory, and the .PBU's in the Unit
directory. This will allow a compile to take place. However,
unless you add code to your program to make windows and use them,
the compiled code is useless. The steps are:
1. Place PBWindow.INC, and PBMice.Inc in your Include
directory
_________________________________________________________________
* These can be placed in PBWindow.Inc so you only need the
$Include metastatement.
1. The demo starts out with this value once the initial sign-on
screen is passed, and then, if this value is reached without a
key being hit, it speeds up the showing by using a 5 second
delay.
Page 6 (c) 1987-90,91 Barry Erick
PBWindow Documentation
2. Place PBWindow.PBU, and PBMiceun.PBU in your PBU
directory
3. Place PBWObj3.OBJ in your OBJ directory
4. Place the statement Max.Window% = nn where nn is the
maximum number of windows you need open at one time. 14 is
a good number, while 5 is the minimum and default if you
try to set it to a lesser number. Set the constant
%PBWSmall to 0, %False to 0, %True to NOT %False and
%NeedRodent to %True. A typical statement would be:
Max.Window% = 14
%PBWSmall = 0
%False = 0
%True = NOT %False
%NeedRodent = %True
5. Place the $INCLUDE metastatement to your program to bring
in the PBWindow.INC file. If you have this in your INC
directory and have saved your configuration so PowerBASIC
knows where to find files (see Options/Directories and
Options/Save in the PowerBASIC manuals or menus or help).
A typical statement would be:
$INCLUDE "PBWindow.INC"
6. Make sure the file PBWOBJ3.OBJ is in your current
directory, the PB Object directory, or your path, as this
file is necessary. To use in your program, you must set
%NeedRodent to %True and use PBMice.Inc and PBMiceun.PBU
if you want mouse support, or set %NeedRodent to %False
and not include either PBMice.Inc or PBMiceun.PBU in your
program.
7. The Include file sets the default variable type to be
integer, so if your program does not have a DEFINT or
other DEFxxx statement in it, the default variable type
will be Integer and not single precision. This is an
important point if some routines no longer work when you
add PBWindows to them. It is perfectly safe to place a
DEFnnn statement after the $INCLUDE metastatement for the
rest of your program to default to your type. Note that
all calls to PBWindow routines require either Integer or
String variables and constants.
8. Add the various PBWindow statements to your program to add
the windows. Note that you have to Make A Box before you
can Print To A Box. A box is the same as a window, and may
be referenced to in either way in this documentation.
To compile the demo, simply load PWDemo.Bas into the IDE and
press Alt-F9 or F10/Compile/Compile. From the PBC, simply type
PBC PWDemo -CE. All command switching has been taken care of in
(c) 1987-90,91 Barry Erick Page 7
PBWindow Documentation
the program. Note that the demo expects to find PBMiceun.PBU and
PbWindow.PBU in either your default directory or PBUDestination
library. The object files, PBWObj3.OBJ, PBMouse.Obj and
PBWTools.OBJ are expected in your default library or PBObj
library and PWDemo.Inc, PBWindow.INC, PBMice.INC, and
PBWTools.INC in your default or INClude directory. The files
Pwdemo.inc and PBWTools are only used in the demo and not needed
to use PBWindow.PBU, PBWObj3.OBJ and PbWindow.INC. PBWTools is
Documented in Appendix C. PBMouse is documented in the file
PBMICED.EXE or PBMiced.Zip, available where you obtained this
file. In addition, this program comes with registration of
PBWindows. This does not automatically register PBMICE, however a
discounted registration of both is possible. See Registration on
page 27.
4 PBWindow Routines
There are three main routines to PBWindows, MakeBox, ZoomBox and
RemoveBox. MakeBox or ZoomBox are the first procedures to call to
make a window, and RemoveBox is the last called, to remove the
window. The rest of the 27 routines support these two main
routines.
MakeBox This routine makes a box. Your limit on the
maximum number of windows open at any time is set
with the Max.Window% variable. The calling
sequence is:
Call MakeBox(Wr%,Wc%,Wh%,Ww%,fc%,bc%,_
BoxKind%,Shadow%,Racket%,Bfc%,Bbc%)
Where:
Wr% WindowRow. The row on the screen
where the windows top row shall
be placed.
Wc% WindowColumn. The Column on the
screen where the windows left
side will be placed.
Wh% WindowHeight. The number of rows
(not the row number) that the
height of the window will take.
This must be two more than the
number of rows you plan to place
within the window.
Ww% WindowWidth. The number of
columns (not the column number)
that the column will take.
Page 8 (c) 1987-90,91 Barry Erick
PBWindow Documentation
fc% ForegroundColor. This is the
color the text within the box
will take. See Table 1 for valid
numbers.
bc% BackgroundColor. This is the
color the text within the box
will take as its background. See
table 1 for valid numbers.
BoxKind% This defines if there will be a
outline around the window. There
are 11 legal values:
0 = Blank (no outline)
1 = Single lines
2 = Double lines
3 = Double vert,
Single horiz
4 = Single vert,
Double horiz
5 = Single horiz, No vert
6 = Double horiz, No vert
7 = Solid border, all around
8 = Light Hatch, all around
9 = Medium Hatch, all around
10 = Heavy Hatch, all around
11 = Same as 5, with no
border
12 = Same as 6, with no
border
13 = Same as 0, with no
border
Shadow% This defines if you want a black
drop shadow, and if so, if you
want that shadow to be solid,
transparent, or hatched. There
are 11 Drop Shadow types:
0 = None
1 = Left , solid
2 = Right , solid
3 = Left , transparent
4 = Right , transparent
5 = Left , Light Hatch
6 = Right , Light Hatch
7 = Left , Medium Hatch
8 = Right , Medium Hatch
9 = Left , Heavy Hatch
10 = Right , Heavy Hatch
(c) 1987-90,91 Barry Erick Page 9
PBWindow Documentation
Racket% Defines whether you want noise
when the window opens or closes.
There are 2 valid values:
0 = No Racket or Noise
1 = Racket or Noise
Bfc% BoxlineForegroundColor. This is
the color the BoxKind line will
have if there is a boxline. For
it to be the same as Fc, use a
-1, otherwise all values for Fc
are valid for Bfc.
Bbc% BoxlineBackgroundColor. This is
the color the BoxKind line
background will have if there is
a boxline. For it to be the same
as Bc, use a -1, otherwise all
values for Bc are valid for Bbc.
Note: If you have a shadow, do
not use 0 (or Black) for best
results.
Table 1: Colors for Fc,Bc,Bfc, and Bbc
0 Black (16) 8 Gray (24)
1 Blue (17) 9 LtBlue (25)
2 Green (18) 10 LtGreen (26)
3 Cyan (19) 11 LtCyan (27)
4 Red (20) 12 LtRed (28)
5 Magenta (21) 13 LtMagenta (29)
6 Brown (22) 14 Yellow (30)
7 White (23) 15 Bright White (31)
16-31 Blinks Foreground
Note that the minimum and maximum values for Wr,
Wc, Wh, and Ww are dependent on the Shadow%
value. The screen positions are normally 1
through 80 across and 1 through 25 up and down.
When a shadow is involved, the bottom of the
raster is always 1 more than Wh, as the width is
also one greater than Ww specifies. If we are
calling for a left drop shadow, then the starting
column is actually one less than Wc, and so the
minimum value is 2. For a right drop shadow, the
maximum screen position is 79, as position 80 is
taken by the shadow.
ZoomBox This routine makes a window that grows in size as
it is made. Other than this, it is exactly the
same as MakeBox. Refer to MakeBox on page 4 for
details of the parameters.
Page 10 (c) 1987-90,91 Barry Erick
PBWindow Documentation
FillArea This routine quickly fills a screen area with one
character at a given attribute. Works on one full
or partial line or a rectangular area on the
screen. This does NOT change the window variable
Wpt%. The calling sequence is:
Call FillArea(firstRow%,FirstColumn%,_
NumOfRows%,NumOfColms%,_
Character%,Attribute%
Where:
FirstRow% This is the starting row on the
screen. The screens first row is
row 1.
FirstColumn% This is the starting column for
the new box. This is offset 1,
where the first column on the
screen is 1.
NumOfRows% This tells how many rows to make.
The minimum is 1, and the maximum
is the current maximum number of
rows on the screen.
NumColumns% The width of the box, or how many
columns to make is carried by
this variable. Minimum is 1 and
max is 80.
Character% This is the character to repeat
in the filled area.
Attribute% This is the attribute to use to
make this one color box.
Rackett This procedure makes a noise if the variable
NoNoise% is %True. If NoNoise% is %False, this
procedure then does nothing. The Calling sequence
is:
Call Rackett
RemoveBox This routine removes a opened window. It removes
the last opened window, and there are no
parameters to pass. The Calling sequence is:
Call RemoveBox
FansWindow This is a editor in the current window with word
wrap.
Example:
(c) 1987-90,91 Barry Erick Page 11
PBWindow Documentation
A$ = FansWindow$(winLin,WinPos,WinWid,_
Chars,fc,bc,fcc,bcc,destr)
Where:
WinLin Is the line in the window to get the
input from.
WinPos Is the offset on the WinLin to start
at.
WinWid If -1, it allows input to the End of
WinLin, else it gets WinWid number of
characters before proceeding to the
next line.
Chars This is the total number of characters
to get. The function exits on this
number or with ESC or ENTER.
fc This is the foreground color of the
inputted characters.
bc This is the background color of the
inputted characters.
fcc This is the cursor foreground color.
bcc This is the cursor background color.
destr This variable, if true, says to
destroy whatever is on the line when
the routine is called, else kill it
when the first character is inputted.
This gets Chars num of chars, or terminates with
Enter or ESC. If ESC, FansByeFlag% is true. The
array FWindXKey$(1-10) carries keys that can be
used to exit this with, in addition to a cr. If
excited, the variable FWXKey$ carries the exit
key. Destr, if true.. immediately kills the line
it is on. If false, it waits for the first key
press. If one of the exit keys, it exits, else it
then writes over the line.
GetAttribute This function returns a integer attribute when
supplied with Forecolor and BackColor, as defined
in Table 1. Usage:
variable% = GetAttribute(ForeColor%,_
BackColor%)
Page 12 (c) 1987-90,91 Barry Erick
PBWindow Documentation
GetForAndBack This procedure supplies the ForeColor and
BackColor integers from a supplied integer
attribute. Calling sequence is:
Call GetForAndBack(attr%,forecolor%,_
backcolor%)
where forecolor and backcolor are as defined in
Table 1.
PrtBox This procedure prints a string within the
currently (last) open window. A Call MakeBox()
must have first been made. Usage:
Call PrtBox(r1%,c1%,stuff$)
where:
o r1% = Row within the window, not screen.
First available row is 1, and is
referenced to Wr+1. The last row available
is Wh-1.
o c1% = Column within the window, not
screen. First available column is 1, and
is referenced to Wc+1. The last column is
Ww-1.
o Stuff$ = The string to print at the Fc and
Fc used when the window was made with
MakeBox.
BoxTitle This places a title on the border line of a box
already made with a call to MakeBox(). There are
12 places, and values, that can be passed. Usage
is:
Call BoxTitle(Where%,What$,Bxfc%,Bxbc%)
Where:
Where% Defines one of 12 places around
the window box for the title to
be:
Table 2: Box Title Locations
Horizontal Vertical
1 = Top Left 7 = Middle Left
2 = Top Middle 8 = Middle Right
3 = Top Right 9 = Top Left
4 = Bot Left 10 = Bot Left
5 = Bot Middle 11 = Top Right
6 = Bot Right 12 = Bot Right
(c) 1987-90,91 Barry Erick Page 13
PBWindow Documentation
What$ Is the Text to place Where. Make
sure it fits. If this is Null,
then the border is rebuilt. Also,
if first character of What$ =
chr$(234) (Ω), then the title
border location is rebuilt using
the new string.
Bxfc% Is the integer color What$ will
be. It may be any valid
foreground color as defined in
Table 1. It will be the same as
Bfc if made equal to -1.
Bxbc% Is the integer color the
background of What$ will be. It
may be any valid background color
as in Table 1. It usually looks
best if it is the same as Bbc.
Making it equal to -1 will make
it equal to Bbc.
BoxScroll This scrolls the text within a window up or down
one row at a time at a specified color. This
allows you to scroll off text in one color, and
bring it back in another color. The entire window
is cleared by calling this routine the number of
rows there is in the window. The calling sequence
is:
Call BoxScroll(Direction%,Fcolor%,Bcolor%)
Where:
Direction% Can be one of two values:
0 = Up one row
1 = Down one row
FColor% Is the color text will be on the
new row, if any is pulled to it,
which it usually isn't. Valid
FColors are the same as Fc in
Table 1. A value of -1 will make
it the same as Fc.
BColor% Is the color of the row
background that is scrolled in.
Valid BColors are the same as Bc,
as shown in Table 1. A value of
-1 will make it the same as Bc.
PartBoxScroll This scrolls a partial area within the current
window. The cleared row is AT the toprow TO the
Page 14 (c) 1987-90,91 Barry Erick
PBWindow Documentation
NumOfRows. IF UpOrDown is 1 (scroll down) OR
upOrDown is 0 (scroll up)
Usage:
CALL PartBoxScroll(UpOrDown%,TopRow%,_
BotRow%,ForegroundColor%,_
BackgroundColor%)
Where:
UpOrDown Is the direction to scroll. 1
means scroll down, 0 to scroll
up.
TopRow% Is the uppermost row to scroll.
BotRow% Is the bottommost row to scroll.
ForegroundColor%
Is the foreground color for the
new scrolled in row.
BackgroundColor%
Is the background color for the
new scrolled in row.
A CALL TO MakeBox must have been made first
CtrBox This is the same as PrtBox, except it centers the
text on the row within the window. The Calling
sequence is:
Call CtrBox(r1%,Stuff$)
Where:
r1% Is the row within the window to
center the string Stuff$.
Stuff$ Is the text to center within the
window at row r1. The color was
defined when the window was made
with MakeBox().
CtrAllBox This is similar to CtrBox, except it centers the
text in the window, both vertically and
horizontal. The calling sequence is:
Call CtrAllBox(Which%,HowMany%,Stuff$)
Where:
Which% Is the number of HowMany this
line of Stuff$ is.
(c) 1987-90,91 Barry Erick Page 15
PBWindow Documentation
HowMany% Is the Total Number of lines that
are to be centered in the current
window.
Stuff$ Is the text to center within the
window at Which line of HowMany
lines.
PrtEOL This does a erase to EndOfLine using the current
attribute of the window. The calling sequence is:
Call PrtEol(Row%,Column%)
Where:
Row% Is the row within the window, not
screen. First available row is 1,
and is referenced to Wr+1. The
last row available is Wh-1.
Column% Is the column within the window,
not screen. First available
column is 1, and is referenced to
Wc+1. The last column is Ww-1.
PrtEOLBox This prints a string within the window and then
does a EOL using the PrtEol procedure. The
calling sequence is:
Call PrtEOLBox(row%,column%,stry$)
Where:
Row% Is the row within the window, not
screen. First available row is 1,
and is referenced to Wr+1. The
last row available is Wh-1.
Column% Is the column within the window,
not screen. First available
column is 1, and is referenced to
Wc+1. The last column is Ww-1.
Stry$ Is the string to print.
PrtAttrEOL This procedure is similar to PrtEOL but it can
change the attributes of the erased line. The
calling sequence is:
Call PrtAttrEOL(row%,Column%,fc%,bc%)
Where:
Page 16 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Row% Is the Row within the window to
work with.
Column% Is the Column of Row% within the
window to preform the EOL with.
fc% Is the new foreground color for
the affected part of the line.
bc% Is the new background color for
the altered line.
PrtAttrEolBox This prints a string in the box at a given row
and then does a PrtAttrEOL for the remainder of
the row. The calling sequence is:
Call PrtAttrEolBox(row%,col%,str$,fc%,bc%)
Where:
row% Is the row within the window to
work with.
Column% Is the column within the row% to
work at.
Str$ Is the string to print at
row%,Column%
fc% Is the foreground color to use.
bc% Is the background color to use.
NewBoxColor This procedure sets the saved attributes of the
current window to your specified color. This will
allow the next action within that window to be of
the new color. The calling sequence is:
Call NewBoxColor(frewe%,bvcxv%)
Where:
Frewe% Is the foreground color.
Bvcxv% Is the background color.
BuildMenu This procedure allows you to use the window
system for menus. Several types and actions are
provided. You can have a pointer to point to
items, a highlighted bar the width of the window,
or the width of the string. The first letter can
be highlighted. Selection can be made on all
types by moving the bar and hitting Enter, or by
(c) 1987-90,91 Barry Erick Page 17
PBWindow Documentation
hitting the highlighted first letter. Another
option allows you to hit the highlighted
character, and if there is more than one item
starting with that character, the next hit of the
same letter will select the next item, and this
will continue and wrap around to the first.
Selection is done with the Enter key or
automatically in this instance. New to this
version is the ability to highlight other than
the first character and highlight more than one
character. You can also assign a Function Key to
the selections.
To use BuildMenu, you must build a list of items
and assign them to the string array mList$().
This array is DIMmed to 20. The last item in the
list must be either a null string ("") or the
2
string "@#$" . This signals the end of the list.
For example:
MList$(1) = "One"
MList$(2) = "Two"
MList$(3) = "@#$" (or MList$(3)="")
Would signal to build a menu consisting of two
items. The calling sequence is:
CALL BuildMenu(mitem%,bmstart%,bmFirst%,_
bment%,bmffore%,bmback%,_
bmhfore%,bmhback%,bmbar%,_
Mlist$(),Auto%,PointerColor%)
Where:
mitem% Is the item number selected
within the menu.
bmstart% Is the item number to start with.
This item will be the highlighted
or pointed to item. Normally this
is 1.
3
bmFirst% If True , this sets the first
letter in each menu item to be
highlighted, and selection by the
first character is allowed. If
False, then this is not possible.
_________________________________________________________________
2. This string is kept for compatibility reasons.
3. Defined in PBWindow.INC, %True = -1 and %False = 0
Page 18 (c) 1987-90,91 Barry Erick
PBWindow Documentation
bment% If True, this means the Enter key
is required on first letter
selection. If False, then hitting
the highlighted first character
selects that item. Note that True
allows several items to share the
same first character, while
setting this false will require
all items to have a unique first
character.
bmffore% This is the foreground color to
use for the first character
highlight. -1 means to use the
same as the box uses.
bmfback% This is the background color to
use for the first character
highlight. -1 means to use the
same color as the box uses.
bmhfore% This is the foreground color for
the menu item when highlighted
with a bar. -1 means to use the
same color as the box.
bmhback% This is the background color for
the menu item when highlighted
with a bar. -1 means to use the
same color as the box.
bmbar% This selects the type of bar:
Table 3: Bars Generated
0 = No Highlight
1 = The Item is Highlighted
2 = The Box Width is Highlighted
3 = An Arrow is used
4 = An Arrow is used and the item
is Highlighted
Mlist$() This is the list for the menu as
described above.
Auto% This variable, if %True, will
allow the menu to return the
current highlighted item as the
selection after a timeout, or by
the user, whichever occurs first.
If %False, the user must make the
selection. The variable
AutoBuildTime% determines the
amount of time waiting. If this
(c) 1987-90,91 Barry Erick Page 19
PBWindow Documentation
routine times out, and is
returned automatically, Auto%
will return %True. If the user
hit a key to select an item, then
Auto% will return %False.
PointerColor% PointerColor% allows the pointer
or arrow, to be a different color
than the highlight. If this is
set to a -1, then the color of
the pointer will be the same as
the highlight defined by the
variable bmhfore%. This variable
must be passed even if you do not
use an option that specifies a
pointer.
Two additional arrays are used for highlighting
other than the first character, or more than one,
or to assign a function key to an item:
BMenuNum(ItemNumber,1) =
The position of the character to be
highlighted in the menu selection. If
left out, this defaults to 1, as in
previous versions where only the first
character was used.
BMenuNum(ItemNumber,2) =
The number of characters to be
highlighted. This defaults to one
character if not used.
See SUB Screen9 for information on how
this is used.
BMenuKeys$(1,Item)=
The Function or ANY key to remap to
another key. For F1, this would be
Chr$(0,59). For ^Q, this would be
Chr$(17), etc.
BMenuKeys$(2,Item)=
The key to Match the above key. If a
selection in the menu is:
Quantum <F1>
and Q is a valid selection, this would
= "Q"
For :
<F1> For this item
and <F1> is highlighted, this should
be "<"
If this item is Chr$(255), then this is a HotExit
item. This means it does not point to a menu
Page 20 (c) 1987-90,91 Barry Erick
PBWindow Documentation
item. The key matching this will allow a hot exit
from the menu without selecting anything.
The variable BuildReturn$ returns the key hit.
This allows several keys to be used. Do note that
you can't check to see if the returned
BuildReturn$ is equal to BmenuKeys$(1,x), since
the BmenuKeys$() array is redimemsioned at the
end of the BuildMenu procedure.
MapKeys This is %True when you want to use a
function key or other key in addition
to the highlighted key. This should be
%False at all other times.
BuildReturn$
The key hit to return, IF this was a
hot exit key as described above.
StickyBm% %True means the last item highlighted
will be highlighted again. This is
most useful if a hot exit is used to
bring in a help screen and you want to
return to that spot on return. This
variable is set to false in the unit
when found.
Also, see the variables Bar0to2Off% and
Bar3or4Off% in Appendix A.0.
PrtAttrBox This prints a string within the current window
using a different attribute than the default, but
does not change the attributes for the window for
subsequent calls. The calling sequence is:
Call PrtAttrBox(Row%,Column%,String$,Fore%,_
Back%)
Where
Row% Is the row within the current
window to use.
Column% Is the row within the current
window and current line.
String$ This is the string to print at
Row%, Column%.
Fore% This is the foreground color to
use. If set to -1, the default
foreground color for the window
is used.
(c) 1987-90,91 Barry Erick Page 21
PBWindow Documentation
Back% This is the background color to
use. If set to -1, the default
background color is used.
ClearBox This clears the current window to the foreground
and background color you specify. The calling
sequence is:
Call ClearBox(Fore%,Back%)
Where:
Fore% Is the foreground color to use.
If set to -1, the default
foreground color is used.
Back% Is the background color to use.
If set to -1, the default
background color is used.
ReColor This allows you to recolor the last window. This
was designed to do this because it would be hard
to work a routine to recolor only the portion of
a window that another one isn't sitting on, which
can happen if we allowed recoloring of more than
the last window. The calling sequence is:
Call ReColor(Fore%,Back%,BorderFore%,_
BorderBack%)
Where:
Fore% Is the new foreground color to
use. If set to -1, the foreground
color will not change.
Back% Is the background color to use.
If set to -1, the default
background color is used for no
apparent change in the
background.
BorderFore% This carries the new border
foreground color. Again, if set
to -1, the color remains
unchanged.
BorderBack% As in the others, this holds the
new background color and if set
to -1 does not change.
WriteScreenArea This is called by MakeBox internally. When Remove
box is called after this, the previous window and
this one is removed. The usage is:
Page 22 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Call WriteScreenArea(UpperLeftRow%,_
UpperLeftCol%,_
NumOfRows%,NumOfCols%,_
Text$,Attrs$)
Where:
UpperLeftRow% is the upper left row number, 1
to 25
UpperLeftCol% is the upper left column of the
box, 1 -80
NumOfCols% is the total number of columns
from the UpperLeftCol.
Text$ is the text to write to the
screen. The length of the string
is determined to be no greater
than NumOfCols, as this routine
is used to write not the entire
box, but one row of the box.
Attrs$ is the attribute to use and must
equal the length of text$
SaveScreenArea This is also called by MakeBox internally.The
usage is:
Call SaveScreenArea(UpperLeftRow%,_
UpplerLeftCol%,_
NumOfRows%,NumOfCols%,_
SaveText$,SaveAttr$)
where:
UpperLeftRow% is the upper left row number, 0
to 24
UpperLeftCol% is the upper left column of the
box, 0 -79
NumOfCols% is the total number of columns
from the UpperLeftCol.
SaveText$ is the text retrieved from the
screen. The length of the string
is equal to NumOfCols, as this
routine is used to read not the
entire box, but one row of the
box.
(c) 1987-90,91 Barry Erick Page 23
PBWindow Documentation
SaveAttr$ is the attribute used on the
screen and equals the length of
text$
PBWindowInit This routine is used by the $Include file. It
returns much video and screen element
information. It also Dims dynamically all arrays.
If RetraceMode% is 0 then we do no retrace on
screen writes, else we do check, for a slower
display. This happens in CGA modes. If you need
to use this just to see the routines, the calling
sequence is:
CALL PBWindowInit
Returned:
ScreenSegment% Returns the screen segment of the
adapter, either &HB000 or &HB800.
RetraceMode% Returns the retrace mode. If you
have a cga adapter, then we use
retrace protection, and this will
return non zero. If zero, then
there is no wait for retrace, and
screen writes are much faster.
You can fool PBWindows into not
using retrace with your program
by using the statement
Retrace% = 0 after the $Include
statement in your program.
EGAok% Says this computers video
display's maximum adapter is a
EGA type.
VGAok% Means this computer is capable of
VGA work.
PBWindowInit calls ScreenInit to return those
variables.
ScreenInit This sub returns the ScreenSegment and Retrace
mode, unlike PBWindowInit, which Dims many arrays
and should only be called once. This may be
called as often as you wish if you need to update
the current modes. The calling sequence is:
Call ScreenInit(ScreenSegment%,RetraceMode%)
Returned:
ScreenSegment% and RetraceMode%
See PbWindowInit for details.
Note: Max.Window% is set in your program to equal the maximum
number of windows you will have open at any one time. This must
Page 24 (c) 1987-90,91 Barry Erick
PBWindow Documentation
be used prior to invoking the $Include metastatement. Also, the
variable AutoBuildTime% should be set at this time if you want
something other than the default of 0. Another constant is
%PBWSmall, which must, for the distributed version, be set to 0.
And, for this version, %NeedRodent must be used.
Example:
AutoBuildTime% = 60 'set timeout to 60 seconds
Max.Window% = 14 'set a max of 14 windows at any one time
%PBWSmall = 0 'necessary constant that MUST be placed
' prior to the next statement or the
' program will not compile.
%NeedRodent = -1 ' = use Mouse routines from PBMouse.
$Include "PBWindows"
(c) 1987-90,91 Barry Erick Page 25
PBWindow Documentation
5 The Demo PWDemo.Bas
The demo file does nothing but demonstrate the routines available
in PBWindow. This file is menu driven, the menu being one built
from the PBWINDOW unit. Following the instructions in section 3
on page 5 will show you how to compile this demo. Briefly, the
file, PWDemo.Bas goes to your \PB default directory,
PWdemo.INC,PBMice.INC,PBWTools.INC, and PBWindow.INC to your
\PB\INC directory, PBWTools.OBJ, PBMouse.OBJ, PBWTools.OBJ and
PBWObj3.OBJ to your \PB\OBJ directory, and PBWindow.PBU and
PBMiceUn.PBU to your \PB\PBU directory. The demo has directives
in it to compile to .EXE, turn off error tests, and to turn off
break tests. Library routines are stripped, as they are not
needed for the demo. If you use the Command Line Compiler
(PBC.EXE), and you do not have a PBC.CFG (configuration) file,
you may place all the files in the same directory as your PBC.EXE
file and simply type PBC PWDEMO /CE to compile this, as the demo
program has metastatements in it to direct the compiler as to its
duties.
When you run the demo, either you make the selections by
selecting and hitting enter on the main menu, and space-bar when
asked to, click on the mouse or do nothing. The demo will
automatically run if the users does nothing for 30 seconds, once
the opening screen is passed. At that time, it changes to a 3
second timeout to make for a faster moving demo than if this were
left at 30 second.
6 Potpourri
6.1 Support available
The author may be contacted in the Spectra area in the
IBM Vendor B Forum on Compuserve (g PCVenB, Section 12) or in the
PowerBASIC Category on Intelec. My Compuserve ID is 75300,214.
If you do not have a modem, I may be reached at decent and normal
Eastern Time Hours (No later than 9 pm Eastern Time) at
717-675-3432.
Page 26 (c) 1987-90,91 Barry Erick
PBWindow Documentation
6.2 Source Code Available
PBWindows is Shareware. Source code to the PBWindow Unit and a
4
printed manual are available . PBMouse source is a shareware
program by itself, and is available from the author of PBWindows
at the reduced price of $5 if registered at the same time as
PBWindows. You are required to purchase or register this program
to use it for both commercial and non-commercial use. Source code
with a manual is $25. Source to PBMiceun along with Source to
PBWindows and a printed manual is $30. If you want this, send the
appropriate amount, including current Pennsylvania State tax for
Pennsylvanian's, to:
Barry Erick
28 Ridge Street
Dallas, PA 18612
Registration for Commercial Users is as follows: For the first
100 copies of a Commercial program this is used in,
registration of two copies of both PBWindows and PBMouse is
required. The fee is $100 for 101 to 1000 programs sold and an
$50 for each thousand or partial thousand, from that point on.
Only one manual and disk will be sent, but the registration as
outlined is all that is needed for commercial license terms.
This license allows use of the INC. PBU and OBJ files, but does
not allow the distribution of any of the Source code. Also let
us know what program this will be used in.
Be sure to state what disk format you want. This can be
supplied on either 5 1/4 or 3.5 inch low density disks at no
extra cost or high density at $2 additional. The latest version
will be sent. You may also use the file Order to print a
registration form.
Foriegn orders must include $5 extra for shipping and the
amount must be in US Dollars drawn on a US Bank or an
International Money Order. All foreign funds will be returned,
since it costs more to convert foreign funds to US funds than
the registration costs.
6.3 Update availability
The .PBU file will need to be updated as new major versions of
PowerBASIC become available, and possibly a minor upgrade will
require this, also. Therefore, the .PBU files will be made
available to users. If the .OBJ file requires a update, it too
will be made available. This availability may mean electronic
distribution via CIS EasyPlex, or it might mean a disk will be
sent to you. In any case, the new version of the entire program
will replace the current version. Contact the author if you
_________________________________________________________________
4. Source to the Object code is not available.
(c) 1987-90,91 Barry Erick Page 27
PBWindow Documentation
need upgrade information when newer versions of PowerBASIC are
released. New source and printed manuals are available as a new
registration.
6.4 Distribution of the programs
The source code for PBWindow.PBU, PBWindow.INC, PBWTools.INC,
PBWTools.OBJ, PWDemo.Bas, PWdemo.Inc PBMiceun.PBU, PBMice.Inc,
PBMouse.OBJ, and PBWObj3.OBJ are copyright material and are not
in the Public Domain, as is any other file by this author
included in this and any other package. The author retains
property rights to any and all routines originated by the
author. You may include the files PBWindow.PBU,
PBWObj3.OBJ,PBWTools.INC, PBWTools.OBJ, PBMiceUn.PBU,
PBMice.INC, PBMouse.OBJ and PBWindow.INC in your programs, but
not the source code to the Units or Object code. This program,
consisting of the files in Table 6.4, on page
28, may be distributed to BBS's, commercial and private,
provided they are distributed together, and the file group is
named PBWindow.* or PBWndo.* if the file name limit is 6
characters, as it is on Compuserve. The file extension, as
noted by the *, shall reflect the the grouping method, such as
.ARC, .PKA, .ZIP, or .LHZ. In addition, the files may be
included in a self-extracting file with the name PBWndo.EXE, or
PBWindow.EXE made by .LHZ OR .ZIP only. This restriction is
placed on the self-extracting file because of the favorable
overhead that LHarc and PKZip places in its self extracting
files. These files may also be distributed by clubs and user
groups providing no more than $10 is charged for expenses and
handling while distributing the files below. Note that this fee
charged does not register the program.
Table 4: Distributed Files
The following files may be freely copied
and distributed as long as they remain together.
PWDemo.Bas PWDemo.INC
PBWindow.Inc PBWindow.PBU
PBWObj3.OBJ PBWTools.INC
PBWTools.OBJ PBMiceUn.PBU
PBMICE.INC PBMice.OBJ
PBWindow.DOC Order
Vendor.DOC BBS.DOC
Page 28 (c) 1987-90,91 Barry Erick
PBWindow Documentation
6.5 Warranty and Disclaimer
Users of PBWindows must accept this disclaimer of warranty:
"PBWindows is supplied as is. The author disclaims all
warranties, expressed or implied, including, without limitation,
the warranties of merchantability and of fitness for any purpose.
The author assumes no liability for damages, direct or
consequential, which may result from the use of PBWindows."
6.6 Copyright Notices
PBMice.INC
PBMiceUn.PBU
PBMiceUn.BAS
PBMouse.ASM
PBMouse.OBJ
PBWindow.PBU,
PBWindow.BAS
PBWObj3.OBJ
PBWObj3.ASM
PBWindow.INC,
PBWTools.INC
PBWTools.ASM
PBWTools.OBJ
PWDemo.BAS,
PWDemo.INC
PWDemo.EXE (c) 1987-1990, 1991 Barry Erick
PowerBASIC (c) 1990 Robert S. Zale
LHarc (c) Haruyasu Yoshizaki (Yoshi)
ARC (c) System Enhancement Associates, Inc.
PKPak, PKUnpak (c) PKWare, Inc.
PKZip, PKUnzip (c) PKWare, Inc.
Other trademarks and Copyrights by the copyright holder.
6.7 Development System
PBWindows was developed on a ZEOS 386SX-20 computer using MS-DOS
5.0 and Quarterdecks QEMM 5.13 Memory Manager. The mice on the
system are a Logitec C7 with mouse driver 6.0 and a Kraft Serial
mouse. The video system is a Cardinal VGA. The Assembly routines
were written using Chicago Softwares ASMED and Borlands Turbo
Assembler, TASM Ver 2.5 and 3.0, in MASM mode. Routines were
tested on this system and a Tandy 100TX with EGA video and DrDos
5.0, a Tandy 1400LT Laptop with Dos 3.2, a IBM PC with Hercules
video and Dos 3.3, A PS/2 -25 with VGA Mono and a Clone with DOS
2.11 and CGA video, among other systems used by beta testers.
(c) 1987-90,91 Barry Erick Page 29
PBWindow Documentation
Page 30 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Appendix A
Public Variables
These are the Public Variables in the file PBWindows. They may be
referenced to in other areas of the program, but should not be
altered nor reused for your own use.
Attrs%(MaxWindow%) Current attribute for which window.
AutoBuildTime% The time for the BuildMenu to wait
for user input before automatically
making the selection. The parameter
Auto% in BuildMenu, must be %True for
this to mean anything. The valid
values of AutoBuildTime% are 1 to
15000 seconds. The demo limits the
values to 20 to 15000 seconds.
IsColr% If true, this system was in color
when PBWindow started. This does not
limit PbWindows to color, but lets
you decide if color is available. Use
ScreenSegment to decide if you even
want to try color. If ScreenSegment
is &B000 then we do have Hercules or
IBM Mono mode, and color should not
be attempted. VidMode% may also be
looked at. If it is 7, then this is a
mono mode.
Bar0to2Off% This offset is added to the starting
column specified by the BmBar%
variable when BmBar is < 3. It is
defaulted to 3. This is active in
Menu display only.
Bar3or4Off% Similar to Bar0to2Off%, this works
for values of BmBar% being 3 or 4.
The default is 0, and this, too, is
only active in Menu display modes.
CGA% This is %True if the current mode is
CGA or 25 line mode.
CGAOk% This variable, when %True, says this
machine is capable of %CGA mode.
(c) 1987-90,91 Barry Erick Page 31
PBWindow Documentation
DeConForBuild% This variable, when %True, flags
BuildMenu to use mouse routines in
addition to keyboard responses.
EGA% When in EGA 43 line mode, this
variable is %True. %False otherwise.
EGAOk% This machine is capable of EGA
operation if this is %True.
BoxBorderAttrs%(MaxWindow%) The attributes of the border for each
window.
BoxKinw%(MaxWindow%) Keeps the window kind for each wpt%.
FansByeFlag% If FansWindow is exited with ESC,
this variable will be set %True.
FWindXKey$() This array carries the character keys
that may be used to exit FansWindow.
FWXKey$ The actual key used to exit
FansWindow is carried in this
variable.
MapKey$() This array holds keys that may be
used in BuildMenu.
BuildReturn$ The key used to exit or select a menu
item in Build Menu is carried in this
variable.
StickyBm% This flag, when %True, says to keep
the present position in the menu when
returning from the function.
BMenuNum%() This array carries the information
telling how to highlight a menu item
with.
BmenuKey$() This carries the keys that may be
used for each menu number.
SaveText$ This internal string carries the
screen text before the current window
wrote over it.
SaveAttr$ This internal string carries the
screen attributes before the current
window wrote over it.
ScreenRowIndex% The row offsets are in this index.
Page 32 (c) 1987-90,91 Barry Erick
PBWindow Documentation
TlCorner%() The character used for each border
type's top left corner is carried in
this array.
TRight%() The character used for each border
type's top right corner is carried in
this array.
BLeft%() The character used for each border
type's bottom left corner is carried
in this array.
BRight%() The character used for each border
type's bottom right corner is carried
in this array.
Horiz%() The character used for each border
type's top and bottom are carried in
this array.
Verti%() The character used for each border
type's sides are carried in this
array.
Max.Window% Variable carries the maximum number
of windows.
Mbc% MakeBoxBackgroundColor holds the last
windows Background color.
Mbbc% MakeBoxBorderBackColor holds last
window's border background color
used.
Mbfc% MakeBoxBorderForeColor holds last
window's border foreground color.
Mfc% MakeBoxForegroundColor holds the
foreground color of the last window.
Mlist$(20) For carrying the items in a menu.
Noise%(MaxWindow%) Noise information for which window.
Note: You can also control how a
window is removed by changing the
value in this array. Normally, a
window is removed with noise if
Racket was made when the window was
made, and vice versa. To make a quiet
removal of a noisy window, set
Noise(WindowNumber) = 0 and to make
it noisy, if the window was quite,
make Noise(WindowNumber) = 1.
(c) 1987-90,91 Barry Erick Page 33
PBWindow Documentation
NoNoise% If 0, then racket or noise is allowed
through the various routines. If
other than 0, then noise is not
allowed, even if the internal sub
Rackett is called.
ScreenSegment% This variable carries the video
segment address.
Shadows%(MaxWindow%) Shadow information for which window.
RetraceMode% This variable is used to see if we
need to check for snow. If
VidMode% = 7, then do NOT make this
%True. It will lock up a mono system.
You can force this off, by placing
the command, RetraceMode = 0 right
after the $Include PBwindow.Inc
statement in your program.
PBWc%(MaxWindow%) Virtual Window Column of which
window.
PBWh%(MaxWindow%) Virtual Window height of which
window.
PBWr%(MaxWindow%) Virtual WindowRow of which window.
PBWw%(MaxWindow%) Virtual Window Width of which window.
VGA% If %True, this machine is currently
in VGA 50 line mode.
VGAok% If %True, then this machine is
capable of VGA 50 line operation.
VidMode% This returns the video mode the
system was in when PbWindows was
initialized. The most common text
color mode is 3, and the mode to look
for is 7. If this is 7, then we have
a Hercules or IBM Monograph adapter.
If we do, then do not use any colors
and definitely do not modify the
variable RetraceMode%, as that cannot
be %true for a mono system. It is
best to leave RetraceMode alone,
anyway.
Wpt% Current window pointer, if 0, no
windows are open.
Page 34 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Appendix B
SHAREWARE
B.1 Definition of Shareware
Shareware distribution gives users a chance to try software
before buying it. If you try a Shareware program and continue
using it, you are expected to register. Individual programs
differ on details -- some request registration while others
require it, some specify a maximum trial period. With
registration, you get anything from the simple right to continue
using the software to an updated program with printed manual.
Copyright laws apply to both Shareware and commercial software,
and the copyright holder retains all rights, with a few specific
exceptions as stated on page 29. Shareware authors are
accomplished programmers, just like commercial authors, and the
programs are of comparable quality. (In both cases, there are
good programs and bad ones!) The main difference is in the method
of distribution. The author specifically grants the right to copy
and distribute the software, either to all and sundry or to a
specific group. For example, some authors require written
permission before a commercial disk vendor may copy their
Shareware.
B.2 Ombudsman
This program is produced by a member of the Association of
Shareware Professionals (). ASP wants to make sure that the
shareware principle works for you. If you are unable to resolve a
shareware-related problem with an ASP member by contacting the
member directly, ASP may be able to help. The ASP Ombudsman can
help you resolve a dispute or problem with an ASP member, but
does not provide technical support for members' products. Please
write to the ASP Ombudsman at 545 Grove Road, Muskegon, MI
49442-9427 or send a Compuserve message via Easyplex to ASP
Ombudsman 70007,3536
(c) 1987-90,91 Barry Erick Page 35
PBWindow Documentation
Page 36 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Appendix C
PBWTools - Tools for PowerBASIC
PBWTools is an object file with a $Include file that provides
many procedures and Functions for PowerBASIC.
To use it, be sure PBWTools.INC and PBWTools.OBJ is in your
current directory and include the following statement in your
programs:
$INCLUDE "PBWTOOLS.INC"
The Procedures :
o CursorSize
o SizeCursor
o TotalEMSPages
o BootMemory
o XMSMemory
o GetDriveInfo
o Date
and the Functions are:
o CoProc o EMSExists
o Printers o EMSBase
o ConvMem o EMSVersion
o GamePorts o XMSPresent
o Shll o CDRoms
o Shrr o ComPorts
o DesqView o BExists
o DosAppend o WhatCPU
o DosPrint o VideoSegment
o DosAssign o EgaVgaMemory
o DosShare o MonitorType
o Win386
They are explained next:
FUNCTION CoProc%
Returns 0 if no Math Coprocessor, else it returns
-1
Example:
(c) 1987-90,91 Barry Erick Page 37
PBWindow Documentation
Print "I found you have ";
if NOT CoProc% then
print "no ";
else
print "a ";
End If
Print "math chip."
FUNCTION Printers%
Returns the number of printers attached.
Example:
Print "Printers you have:";printers%
FUNCTION ConvMem%
Returns the amount of conventional memory.
Example:
Print "This computer has ";ConvMem;" kbytes
Print "conventional memory"
FUNCTION GamePorts%
Returns the number of game Ports on the computer.
Example:
Print "Gameports on this computer:";GamePorts%
FUNCTION Shll%(IntegerToShiftLeft,Count)
Shifts the passed integer Left Count times
Example:
Print Shll%(2,2) 'result is 4
FUNCTION Shrr%(IntegerToShiftRight,Count)
Shifts the passed integer Right Count times
Example:
Print Shrr%(4,2) 'result is 2
FUNCTION Desqview%
Returns 0 if Desqview is not running, -1 if it is.
example:
Print "Desqview is ";
if Not Desqview% Then print "not ";
Print "running"
FUNCTION DOSAppend
This returns true (-1) if Dos Append is in
progress. Otherwise it returns 0.
Example:
Page 38 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Print "DOS Append is ";
if NOT DOSAppend then print "not ";
Print "active."
FUNCTION DOSPrint
This returns true (-1) if DOS Print is active,
otherwise 0 is returned.
Example:
Print "DOS Print is ";
if NOT DOSPrint then print "not ";
Print "active.";
FUNCTION DOSAssign
This returns true (-1) if DOS Assign is active. 0
is returned otherwise.
Example:
Print "DOS Assign is ";
if NOT DosAssign then print "not ";
Print "active."
FUNCTION DOSShare
This returns true (-1) if DOS Share has been
loaded, 0
if it has not.
Example:
Print "DOS Share is ";
if NOT DOSShare then Print "not ";
Print "active."
FUNCTION Win386
This function returns the level of MS Windows if
you are running IN enhanced MODE within a DOS
window.
The levels returned are:
0, 80H = Not running in Enhanced Mode
1, -1 = Windows Version 2.0
ELSE = High bit = M<ajor version,
Lo bit = Minor version
Example:
(c) 1987-90,91 Barry Erick Page 39
PBWindow Documentation
Print "Windows 386 is ";
j% = Win386%
Select case j%
case 0,80h
print "is not running."
case 1, -1
print "running Version 2.0"
case else
print "Version ";Ltrim$(Str$(j% Mod 256);
print ".";Ltrim$(Str$(j%\256))
End Select
FUNCTION EMSExists
Returns true is there is EMS memory, 0 otherwise.
Example:
Print "There is ";
if NOT EMSExists% then print "not ";
Print "EMS Memory"
FUNCTION EMSBase
This returns the base address of the EMS Page
Example:
Print "EMS Page is ";Hex$(EmsBase)
FUNCTION EMSVersion$
This returns a string with the EMS Version.
Example:
Print EmsVersion$
FUNCTION XMSPresent%
This returns true if Xms is present, 0 or false if
not.
Example:
Print "This computer does ";
if NOT XMSPresent% then print "not ";
Print "have XMS memory present."
FUNCTION CDRoms%
This returns True (-1) if a CDRom driver is found,
False (0) otherwise.
Example
If CdRoms% then
Print "Hey! You have a CDRom!"
Else
Print "Not yet, but someday you ";
Print "may have a CDRom.
End if
Page 40 (c) 1987-90,91 Barry Erick
PBWindow Documentation
FUNCTION ComPorts%
This returns the number of comports present.
Example:
Print "This computer has ";
Print comports%;" comports."
FUNCTION BExists%(Filename$)
Returns -1 if the passed path and filename are
found, 0 otherwise.
Example:
IF BExists%("Gloop.bas") = 0 then
print "File not found"
else
print "File not found"
End if
FUNCTION WhatCpu%
Returns the last 2 or 3 significant digits of the
cpu. This does not test for a V20 chip, so that
will be shown as a 86.
Example:
Print "The cpu is a 80";
Print Ltrim$(Str$(WhatCpu%))
FUNCTION VideoSegment%
This returns the current video segment
Example:
Print "The current video segment is ";
Print Hex$(VideoSegment%)
FUNCTION EgaVgaMemory%
This returns the number of 64k blocks in EgaVga
memory. If 4, this means there is at least 256k,
since all cards do not return the same id for more
memory than that. If not a Ega/Vga card, then 0 is
returned.
Example:
j%=EgaVgaMemory%
Print "Your video board has ";
if j%=4 then print "at least ";
Print Ltrim$(Str$(j%*64));"k memory"
FUNCTION MonitorType%
This returns an integer representing the monitor
type:
(c) 1987-90,91 Barry Erick Page 41
PBWindow Documentation
1 = Herc Mono
2 = Mono
3 = CGA or CGA Emulation
4 = EGA Mono
5 = EGA Color
6 = VGA Mono
7 = VGA Color
Example:
Print MonitorType%
SUB CursorSize(Top%,Bottom%)
This returns the current cursor's Top% row and
Bottom% row.
SUB SizeCursor(StartLine%,EndingLine%)
This sets the current cursor to start at the
StartLine% and continue to the EndingLine%. This
does not work under all routines.
SUB BootMemory(ConvMemory%,ExtendedMemory%)
This returns the amount of Conventional Memory and
Extended Memory reported at boot time.
Sub TotalEmsPages(TotPages%,TotPageMemK%,
UnallocatedPages%,UnalocMemK%)
This returns the total number of EMS pages in
TotPages. The total page memory in K in
TotPageMemK, the number of unallocated pages in
UnallocatedPages, and the Unallocated memory in k
in UnalocMemK.
SUB XMSMemory(Size%,TotalFree%)
Returns the amount of XMS memory in k in size and
the amount of free XMS memory in k in TotalFree.
SUB GetDriveInfo(drive%,TotBytes&,FreeBytes&)
Called with the current drive, this returns the
total bytes of the drive in TotBytes&, and the
free bytes on that drive in FreeBytes&.
The drive is :
0 = default or current drive
1 = A
2 = B
80h = C
81H = D , etc.
Sub Date(Month$,Day%,Year%,WeekDayName$)
Called with initialized or uninitialized
variables, this returns the Day%,and Year% from
DOS and Strings representing the weekday.. ie
Sunday, Monday, Tuesday, etc.and Month, such as
Page 42 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Jan Feb Mar, etc. The strings is initialized to
be the length of the weekday or Month name only
even if the string passed to the routine is longer
or shorter than the result.
(c) 1987-90,91 Barry Erick Page 43
PBWindow Documentation
Page 44 (c) 1987-90,91 Barry Erick
PBWindow Documentation
Index
$INCLUDE 7 CursorSize 42
%PBWSmall 6, 25
D
A Date 42
ASP See: Association of Demo
Shareware About 26
Professionals AutoBuildTime 6
Association of Automatic Running 6,
Shareware 26
Professionals 35 Compiling 8
Auto 19 Running 26
AutoBuildTime 19, 25 Desqview 38
Direction 14
B directory 7
BackgroundColor 17 Distributing the
BExists 41 programs 28
BootMemory 42 DOSAppend 38
BoxKind 9 DOSAssign 39
BoxlineBackgroundColor DoSaveCursor 5
10 DOSPrint 39
BoxlineForegroundColor DOSShare 39
10 Down 14
BoxScroll 14 drop shadow 2, 9
BoxTitle 13
BuildMenu 17 E
BuildReturn$ 21 EgaVgaMemory 41
EMSBase 40
C EMSExists 40
CDRoms 40 EMSVersion$ 40
Centering 15 Explode See:
ClearBox 22 Zoom,Zooming
CLS See: ClearBox
Command Line Switch 6 F
commercial license 27 FansWindow 11
Commercial Users 27 FillArea 5, 10
compile 7 FixLocate 5
Compiling 5 ForegroundColor 17
ComPorts 41 Functions
Compuserve 26 GetAttribute 12
Constants 6
ConvMem 38 G
CoProc 37 GamePorts 38
Copyright 35 GetAttribute 12
CtrAllBox 15 GetDriveInfo 42
CtrBox 15 GetForAndBack 12
(c) 1987-90,91 Barry Erick Page 45
PBWindow Documentation
H GamePorts 37
Hercules 3 MonitorType 37
Printers 37
K Shll 37
Kinds of Windows See: Shrr 37
BoxKind VideoSegment 37
WhatCPU 37
L Win386 37
lines 9 XMSPresent 37
LocateCursor 5 PBWTools Procedures
Locked up system 34 BootMemory 37
CursorSize 37
M Date 37
MakeBox 8, 10, 13, 15, GetDriveInfo 37
22, 23 SizeCursor 37
Manual TotalEMSPages 37
printed 27 XMSMemory 37
Max.Window 6, 7, 24, 25 PointerColor 20
Menu 17 pop-up windows 5
metastatement 6 Power Pak 1
Mlist 19 PowerBASIC 2.1x 1
mList 18 Printed manual 27
MonitorType 41 Printers 38
Mono 3 Procedures
BoxScroll 14
N BuildMenu 17
NewBoxColor 17 ClearBox 22
Noise 1 CtrAllBox 15
NoNoise 11 CtrBox 15
Number of Windows See: FansWindow 11
Max.Window FillArea 11
GetForAndBack 13
O MakeBox 8
Ombudsman 35 NewBoxColor 17
PartBoxScroll 14
P PBWindowInit 24
PartBoxScroll 14 PrtAttrBox 21
PBWindowInit 24 PrtAttrEolBox 17
PBWSmall 25 PrtBox 13
PBWTools Functions PrtEOL 16
BExists 37 PrtEOLBox 16
CDRoms 37 Rackett 11
ComPorts 37 Recolor 22
ConvMem 37 RemoveBox 11
CoProc 37 SaveScreenArea 23
DesqView 37 ScreenInit 24
DosAppend 37 WriteScreenArea 22
DosAssign 37 ZoomBox 10
DosPrint 37 PrtAttrBox 21
DosShare 37 PrtAttrEOL 16
EgaVgaMemory 37 PrtAttrEolBox 17
EMSBase 37 PrtBox 13
EmsExists 37 PrtEOL 16
EMSVersion 37 PrtEOLBox 16
Page 46 (c) 1987-90,91 Barry Erick
PBWindow Documentation
R BuildReturn$ 32
Racket 33 CGA 31
Rackett 11 CGAok 31
ReadVidP 5 DeConForBuild 31
ReColor 22 EGA 32
recolor 1 EGAok 24, 32
RemoveBox 8, 11 FansByeFlag 32
Restore Title 14 FWindXKey$() 32
RetraceMode 24 FWXKey$ 32
Row 13 Horiz() 33
IsColr% 31
S MapKey() 32
SaveScreenArea 5, 23 Max.Window% 33
screen area 11 Mbbc 33
screen positions 10 Mbc 33
ScreenInit 24 Mbfc 33
ScreenSegment 24 Mfc 33
Scroll 5, See: Mlist$(20) 33
BoxScroll Noise(MaxWindow%) 33
SetCursor 5 NoNoise 33
Shadow 9 NumOfCols 23
Shareware 35 PBWc(MaxWindow%) 34
Shll 38 PBWh(MaxWindow%) 34
Shll% 38 PBWr(MaxWindow%) 34
Shrr% 38 PBWw(MaxWindow%) 34
SizeCursor 42 Racket 9
Source code RetraceMode 34
availability 27 SaveAttr$ 32
Support 26 Savetext$ 32
ScreenRowIndex 32
T ScreenSegment 34
Title See: BoxTitle Shadows(MaxWindow%)
TotalEmsPages 42 34
Tracking 1 StickyBm 32
transparent 2 TlCorner() 32
TRight() 33
U Verti() 33
Up 14 VGA 34
VGAok 24, 34
V VidMode 34
Variables Wpt 34
Attrs(MaxWindow%) 31 VideoSegment 41
AutoBuildTime 19, 31
Bar3or4Off% 31 W
Bar0to2Off% 31 weekday 42
BLeft() 33 WhatCpu 41
BMenuKey$() 32 Win386 39
BMenuNum() 32 WriteScreenArea 5, 22
BoxBorderAttrs(MaxWindow%)ritVidP 5
32
BoxKinw%(MaxWindow%) X
32 XMSMemory 42
BRight() 33 XMSPresent 40
(c) 1987-90,91 Barry Erick Page 47
PBWindow Documentation
Z ZoomBox 8, 10
Zoom 1
Page 48 (c) 1987-90,91 Barry Erick